<?php
########################################################################################
# Empresa :     Tecnopac Informatica;                                                  #
# Autor:        Deiverson Pacheco;                                                     #
# Data Criação: 18/12/2010;                                                            #
########################################################################################
session_start();
header("Cache-control: private");
include_once("../../includes/session.php");


//Linha para formatação de caracteres com acentuação
header("Content-Type: text/html; charset=ISO-8859-1",true);


//======================================================================================
//==> Include obrigatórias no script
//======================================================================================
include_once('../../includes/classes/class.TemplatePower.php');
include_once('../../includes/classes/class.Conexao.php');
include_once('../../includes/classes/class.Geral.php');
include_once('../../includes/classes/class.Paginador_Popup.php');


//======================================================================================
//==> Inicializar Classes
//======================================================================================
$not  = new Persist;
$data = new getData;
$cor  = new ColorTr;
$util = new Util;
$vld  = new ValidarDados;
$sql  = new SqlInjection;
$Paginacao = new Paginacao(5,3);

//======================================================================================
//==> Instanciar TemplatePower para juntar o PHP + HTML
//======================================================================================
$tpl  = new TemplatePower('../../html/estoque/popup_locais_entrada.html');
$tpl->prepare();


//======================================================================================
//==> Recebe variaveis de pesquisa
//======================================================================================
$pagina = @$_GET['pagina'] == '' ? 1 : $_GET['pagina'];

$cont   = 1;
$not->sql = "select id, local
			 from locais
			 where ativo = '1' order by local asc";

$tpl->assign('pag',$Paginacao->montaPaginacao($not->sql,'popup_locais_entrada.php?',$pagina));
$not->sql = $Paginacao->montaQuery($not->sql,$pagina);
			 
if($not->ler()>0){
	while($not->ini()){
		$tpl->newBlock('LOOP');
		$tpl->assign('cont',$cont);
		$cont++;
		
		$tpl->assign('id', $not->id);
		$tpl->assign('par_id',$not->id);
		$tpl->assign('nome', $not->local);
		$tpl->assign('cor', $cor->altColor());		
		
	}
}
$tpl->goToBlock('_ROOT');

//======================================================================================
//==> Enviar página unificada PHP + HTML
//======================================================================================
$tpl->showUnAssigned( false );  // para debug. na hora de publicar, setar para false
$tpl->printToScreen();
?>